<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/static/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>日常分析总结</title>
    <%@include file="../../public/commonCss.jsp" %>
    <%@include file="../../public/commonJs.jsp" %>
</head>
<body ms-controller="main" class="ms-controller">
<div id="wrapper">
    <div class="boxtoolbar whiteBox actionArea contentbox">
        <div class="boxtoolbar whiteBox actionArea contentbox">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" ms-duplex="searchKey.startDate"
                           class="layui-input Wdate"
                           onClick="WdatePicker({readOnly:true,maxDate:'%y-%M-{%d-1}'})"/>
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <button class="layui-btn layui-btn-normal layui-btn-small" ms-on-click="searchData()">搜索</button>
                </div>
                <div class="layui-form-mid layui-word-aux">注*：只能显示前一天的评分数据。</div>
            </div>
        </div>
    </div>
    <div class="boxmain whiteBox lrbox" style="margin-top:-90px">
        <div class="lrboxmain borderL" style="margin-left:0%">
            <div class="from-header borderB contentbox">
                <div>
                    <span class="font14"> 所属分类:</span><a id="category"><span class=" fontOrange2">日常得分统计</span></a>
                    <button class="layui-btn layui-btn-small layui-btn-normal fr" style="margin-right:20px"
                            onclick="exportExcel()">导出excel
                    </button>
                </div>
            </div>
            <div class="from-body withheader contentbox" style=" overflow: auto;">
                <table class="layui-table">
                    <thead>
                    <tr align="center">
                        <th>行号</th>
                        <th>人员编号</th>
                        <th>人员姓名</th>
                        <th>交路名称</th>
                        <th width="40%">车次得分</th>
                        <th>系统得分</th>
                        <th>最终得分</th>
                        <th>修改人</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ms-repeat="tableDatas">
                        <td>{{$index+1}}</td>
                        <td>{{el.userNum}}</td>
                        <td>{{el.userName}}</td>
                        <td>{{el.roadName}}</td>
                        <td>{{el.trainCodeScore}}</td>
                        <td>
                            <span style="color:blue">{{el.sysScore}}</span> 分
                        </td>
                        <td>
                            <span style="color:red">{{el.finalScore}}</span> 分
                        </td>
                        <td>
                            {{(el.modUser==null||el.modUser=="")?"-":el.modUser}}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!-- whitebox -->
</div>
<script type="text/javascript">
    var vm;
    avalon.ready(function () {
        vm = avalon.define({
            $id: "main",
            tableDatas: [],//图片数据
            searchKey: {
                startDate: '${today}'
            }
        })
        avalon.scan();
        loadTableData();
    });

    function searchData() {
        loadTableData();
    }

    //加载表格数据
    function loadTableData() {
        var dataStr = $.param(vm.$model.searchKey);
        $.ajax({
            type: 'post',
            url: '${ctx}/countDayController/selectAllUserTrainScore.action',
            data: dataStr,
            beforeSend: function () {
                layui.layer.msg('正在加载...', {time: 0, icon: 16, shade: 0.02});
            },
            dataType: "json",
            timeout: 10000,
            success: function (data) {
                closeDialog();
                if (data.code == 0) {
                    vm.tableDatas = data.datas;
                } else if (data.code == -1) {
                    top.showErrorMsg("数据加载失败");
                }
            }
        });

    }

    //导出excel
    function exportExcel() {

        window.location.href = "${ctx}/countDayController/exportExcelAllUserScore.action?startDate=" + vm.$model.searchKey.startDate;

    }
</script>
</body>
</html>